package com.zhiwang.xiaoqu.di.module

import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import com.zhiwang.xiaoqu.R
import com.zhiwang.xiaoqu.mvp.model.Store
import com.zhiwang.xiaoqu.ui.MainActivity
import com.zhiwang.xiaoqu.ui.fragment.MyFragment
import com.zhiwang.xiaoqu.ui.fragment.WebViewFragment
import com.zhiwang.xiaoqu.ui.main.MoneyFragment
import com.zhiwang.xiaoqu.widget.ArcTabBar
import dagger.Binds
import dagger.Module
import dagger.Provides
import javax.inject.Named

@Module
class MainActivityModule {
    //
    //private val host: Activity
    //
    //constructor(host: Activity) {
    //    this.host = host
    //}


    @Provides
    fun provideFragmentList(): ArrayList<Fragment> {


        return arrayListOf(
            MoneyFragment(),
            WebViewFragment.newInstance(Store.URL_RED_PACKET, ""),
            WebViewFragment.newInstance(Store.URL_INVITE, ""),
            WebViewFragment.newInstance(Store.URL_RANK, "试玩排行"),
            MyFragment()
        )


    }

    @Provides
    fun provideTabEntities(): ArrayList<ArcTabBar.TabParam> {
        return arrayListOf(
            ArcTabBar.TabParam(
                "赚钱",
                R.drawable.zhuanqian,
                R.drawable.zhuanqian_gray,
                R.color.colorSelected,
                R.color.colorUnselected,
                14f
            ), ArcTabBar.TabParam(
                "红包",
                R.drawable.hongbao,
                R.drawable.hongbao_gray,
                R.color.colorSelected,
                R.color.colorUnselected,
                14f
            ), ArcTabBar.TabParam(
                "邀请好礼",
                R.drawable.yqhl,
                R.drawable.yqhl,
                R.color.colorSelected,
                R.color.colorUnselected,
                14f
            ), ArcTabBar.TabParam(
                "发现",
                R.drawable.faxian,
                R.drawable.faxian_gray,
                R.color.colorSelected,
                R.color.colorUnselected,
                14f
            ), ArcTabBar.TabParam(
                "我的",
                R.drawable.my,
                R.drawable.my_gray,
                R.color.colorSelected,
                R.color.colorUnselected,
                14f
            )
        )
    }

    @Named("mainTabTags")
    @Provides
    fun provideTabTags(): ArrayList<String> {
        return arrayListOf(
            MoneyFragment::class.java.name,
            Store.URL_RED_PACKET,
            Store.URL_INVITE,
            Store.URL_RANK,
            MyFragment::class.java.name

        )
    }


    @Named("dummyTags")
    @Provides
    fun provideDummyStrings(): ArrayList<String> {
        return arrayListOf("tico", "zimmy")
    }


}

@Module
abstract class MainBindModule {

    @Binds
    abstract fun provideScope(activity: MainActivity): LifecycleOwner
}
